class PacketState:
    UNHANDLED = 1
    INFO_UPDATED = 2
    ROUTE_PACKET_UPDATED = 3
    DATA_PACKET_SENT = 4
    REMAINED_IN_QUEUE = 5

    # Reasons for dropped packets.
    NOT_ENOUGH_BATTERY = 6
    QUEUE_FULL = 7



class Packet():
    """
    Base packet class.
    """
    def __init__(self, src_node_id, dst_node_id, packet_size):
        """
        Constructor.
        """
        self._src_node_id = src_node_id
        self._dst_node_id = dst_node_id
        self._packet_size = packet_size
        self._last_node_id = self._src_node_id
        self.mark_sent = PacketState.UNHANDLED
        self.num_steps_until_received = 0
        self.packet_received = False
        self.num_hops = 0

    def get_source(self):
        """
        Returns the id of the node which originated this update pakcet.
        """
        return self._src_node_id
        
    def get_destination(self):
        """
        Returns the id of the destination of this packet.
        """
        return self._dst_node_id
        
    def set_last_node(self, last_node_id):
        """
        Sets the id of the last node that forwarded/sent this packet.
        """
        self._last_node_id = last_node_id
                
    def get_packet_size(self):
        """
        Returns the size of this packet in "size" units.
        """
        return self._packet_size
        
    def get_last_node(self):
        """
        Returns the id of the last node that forwarded/sent this packet.
        """
        return self._last_node_id
